package com.muyu.system.controller;

import com.muyu.common.core.domain.Result;
import com.muyu.system.danmo.dto.PaymentCallBackResult;
import com.muyu.system.danmo.vo.RefundResultServiceVO;
import com.muyu.system.service.SecurityDepositService;
import com.muyu.system.shopping.fegin.SecurityDepositFegin;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("/security/fegin")
@RequiredArgsConstructor
public class SecurityDepositFeginController implements SecurityDepositFegin {


    private final SecurityDepositService securityDepositService;


    /**
     * 处理保证金支付结果
     * @param paymentCallBackResult
     * @return
     */
    @Override
    @PostMapping("/pay/results")
    public Result<String> payResultsHandle(@RequestBody PaymentCallBackResult paymentCallBackResult) {
        securityDepositService.payResultsHandle(paymentCallBackResult);
        return Result.success();
    }


    /**
     * 处理保证金退款结果
     * @param refundResultServiceVO
     * @return
     */
    @Override
    @PostMapping("/refund/results")
    public Result<String> refundResultsHandle(@RequestBody RefundResultServiceVO refundResultServiceVO) {
        securityDepositService.refundResultsHandle(refundResultServiceVO);
        return Result.success();
    }

    /**
     * 处理手续费支付结果
     * @param paymentCallBackResult
     * @return
     */
    @Override
    @PostMapping("/premium/pay/results")
    public Result<String> premiumPayResults(@RequestBody PaymentCallBackResult paymentCallBackResult) {
        securityDepositService.premiumPayResults(paymentCallBackResult);
        return Result.success();
    }
}
